|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jhotdraw.beans.AbstractBean
org.jhotdraw.draw.AbstractTool
org.jhotdraw.draw.CreationTool
org.jhotdraw.draw.TextAreaTool
public class TextAreaTool
A tool to create new or edit existing figures that implement the TextHolderFigure interface, such as TextAreaFigure. The figure to be created is specified by a prototype.
To create a figure using the TextAreaTool, the user does the following mouse gestures on a DrawingView:
To edit an existing text figure using the TextAreaTool, the user does the following mouse gesture on a DrawingView:
The TextAreaTool then uses Figure.findFigureInside to find a Figure that implements the TextHolderFigure interface and that is editable. Then it overlays a text area over the drawing where the user can enter the text for the Figure.
XXX - Maybe this class should be split up into a CreateTextAreaTool and a EditTextAreaTool.
TextHolderFigure,
FloatingTextArea,
Serialized Form| Field Summary | |
|---|---|
private boolean |
isForCreationOnly
By default this tool is only used for the creation of new TextAreaFigures. |
private java.awt.Color |
rubberbandColor
Rubberband color of the tool. |
private FloatingTextArea |
textArea
|
private TextHolderFigure |
typingTarget
|
| Fields inherited from class org.jhotdraw.draw.CreationTool |
|---|
createdFigure |
| Fields inherited from class org.jhotdraw.draw.AbstractTool |
|---|
anchor, editor, isWorking, listenerList |
| Fields inherited from class org.jhotdraw.beans.AbstractBean |
|---|
propertySupport |
| Constructor Summary | |
|---|---|
TextAreaTool(TextHolderFigure prototype)
Creates a new instance. |
|
TextAreaTool(TextHolderFigure prototype,
java.util.Map attributes)
|
|
| Method Summary | |
|---|---|
void |
actionPerformed(java.awt.event.ActionEvent event)
|
protected void |
beginEdit(TextHolderFigure textHolder)
|
protected void |
creationFinished(Figure createdFigure)
This method allows subclasses to do perform additonal user interactions after the new figure has been created. |
void |
deactivate(DrawingEditor editor)
Deactivates the tool. |
void |
draw(java.awt.Graphics2D g)
Draws the tool. |
protected void |
endEdit()
|
private java.awt.geom.Rectangle2D.Double |
getFieldBounds(TextHolderFigure figure)
|
boolean |
isForCreationOnly()
Returns true, if this tool can be only be used for creation of TextHolderFigures and not for editing existing ones. |
void |
mousePressed(java.awt.event.MouseEvent e)
Creates a new figure at the mouse location. |
void |
setForCreationOnly(boolean newValue)
By default this tool is used to create a new TextHolderFigure. |
void |
setRubberbandColor(java.awt.Color c)
Sets the rubberband color for the tool. |
| Methods inherited from class org.jhotdraw.draw.CreationTool |
|---|
activate, createFigure, getAddedFigure, getCreatedFigure, getPrototype, isToolDoneAfterCreation, mouseDragged, mouseReleased, setToolDoneAfterCreation |
| Methods inherited from class org.jhotdraw.draw.AbstractTool |
|---|
addToolListener, addUndoableEditListener, constrainPoint, constrainPoint, createActionMap, createInputMap, editCopy, editCut, editDelete, editDuplicate, editPaste, fireAreaInvalidated, fireAreaInvalidated, fireToolDone, fireToolStarted, getActionMap, getDrawing, getEditor, getInputMap, getView, isActive, keyPressed, keyReleased, keyTyped, mouseClicked, mouseEntered, mouseExited, mouseMoved, removeToolListener, removeUndoableEditListener, setActionMap, setInputMap, updateCursor, viewToDrawing |
| Methods inherited from class org.jhotdraw.beans.AbstractBean |
|---|
addPropertyChangeListener, addPropertyChangeListener, clone, firePropertyChange, firePropertyChange, firePropertyChange, removePropertyChangeListener, removePropertyChangeListener |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private FloatingTextArea textArea
private TextHolderFigure typingTarget
private boolean isForCreationOnly
private java.awt.Color rubberbandColor
| Constructor Detail |
|---|
public TextAreaTool(TextHolderFigure prototype)
public TextAreaTool(TextHolderFigure prototype,
java.util.Map attributes)
| Method Detail |
|---|
public void setRubberbandColor(java.awt.Color c)
c - Rubberband color or null.public void setForCreationOnly(boolean newValue)
public boolean isForCreationOnly()
public void deactivate(DrawingEditor editor)
Tool
deactivate in interface Tooldeactivate in class CreationToolpublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenermousePressed in class CreationToolprotected void creationFinished(Figure createdFigure)
creationFinished in class CreationToolpublic void draw(java.awt.Graphics2D g)
Tool
draw in interface Tooldraw in class AbstractToolprotected void beginEdit(TextHolderFigure textHolder)
private java.awt.geom.Rectangle2D.Double getFieldBounds(TextHolderFigure figure)
protected void endEdit()
public void actionPerformed(java.awt.event.ActionEvent event)
actionPerformed in interface java.awt.event.ActionListener
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||